<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function disptime(){
           var today = new Date();  
           var hour = today.getHours(); 
           var mimute = today.getMinutes();
           var second = today.getSeconds();
           var year=today.getFullYear();
           var month=today.getMonth();
           var day=today.getDate();
           document.write('今天的日期：'+year+'/'+month+'/'+day+'<br>'); 
           document.write('请输入日期：'+'<br>'+'<bl>'); 
        }
        disptime();
        function js(){
            var today = new Date();
            var year=today.getFullYear();
            var month=today.getMonth();
            var day=today.getDate(); 
            var myyear=document.getElementById("y").value;
            var mymonth=document.getElementById("m").value;
            var myday=document.getElementById("d").value;
            var time=Number(new Date(myyear,mymonth,myday));
            var nowTime=Number(new Date(year,month,day));
            var timediff=Math.round((time-today)/1000);
            var da=parseInt(timediff/3600/24);
            document.getElementById("1").innerHTML=da;     

        }
        js(); 
    </script>
    <input type="text" id="y"><span>年</span>
    <input type="text" id="m"><span>月</span>
    <input type="text" id="d"><span>日</span>
    <input type="button" value="计算" onclick="js()">
    <div class="time1">还剩时间：
    <span id="1"></span>天 
    </div>
</body>
</html>